package com.aefottt.struggle_star.bean;

import com.aefottt.struggle_star.util.DatabaseUtil;

import org.litepal.LitePal;
import org.litepal.crud.LitePalSupport;

import java.util.List;

public class ListBean extends LitePalSupport {
    private int listId; // 清单Id
    private int rank; // 排序
    private String listName; // 清单名称
    private String listDesc; // 清单描述
    private int listIcon; // 清单图标
    private final long createTime; // 创建时间

//    public ListBean(String listName, String listDesc, int rank, int listIcon) {
//        // 获取最大的Id
//        this.listId = DatabaseUtil.getLatestId(getClass(), "listId") + 1;
//        this.listName = listName;
//        this.listDesc = listDesc;
//        this.rank = rank;
//        this.listIcon = listIcon;
//        this.createTime = System.currentTimeMillis();
//    }

    public ListBean(int listId, String listName, String listDesc, int rank, int listIcon) {
        // 获取最大的Id
        this.listId = listId;
        this.listName = listName;
        this.listDesc = listDesc;
        this.rank = rank;
        this.listIcon = listIcon;
        this.createTime = System.currentTimeMillis();
    }

    public int getListId() {
        return listId;
    }

    public void setListId(int listId) {
        this.listId = listId;
    }

    public String getListName() {
        return listName;
    }

    public void setListName(String listName) {
        this.listName = listName;
    }

    public String getListDesc() {
        return listDesc;
    }

    public void setListDesc(String listDesc) {
        this.listDesc = listDesc;
    }

    public int getListIcon() {
        return listIcon;
    }

    public void setListIcon(int listIcon) {
        this.listIcon = listIcon;
    }

    public long getCreateTime() {
        return createTime;
    }

    public List<DataBean> getDataBeans() {
        return LitePal.where("listId = ?", String.valueOf(listId)).find(DataBean.class);
    }
}
